/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "dato_vivienda_entorno", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "DatoViviendaEntorno.findAll", query = "SELECT d FROM DatoViviendaEntorno d"),
    @NamedQuery(name = "DatoViviendaEntorno.findByIdDatoViviendaEntorno", query = "SELECT d FROM DatoViviendaEntorno d WHERE d.idDatoViviendaEntorno = :idDatoViviendaEntorno"),
    @NamedQuery(name = "DatoViviendaEntorno.findByDveTenencia", query = "SELECT d FROM DatoViviendaEntorno d WHERE d.dveTenencia = :dveTenencia")})
public class HousingEnvironmentData implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_dato_vivienda_entorno")
    private Integer id;
    @Column(name = "dve_tenencia")
    private Boolean possession;
    @JoinColumn(name = "vis_id_visita_domiciliaria", referencedColumnName = "id_visita_domiciliaria")
    @ManyToOne(optional = false)
    private HomeVisit homeVisit;
    @JoinColumn(name = "nve_id_nombre_vivienda_entorno", referencedColumnName = "id_nombre_vivienda_entorno")
    @ManyToOne(optional = false)
    private HousingEnvironmentName housingEnvironmentName;

    public HousingEnvironmentData() {
    }

    public HousingEnvironmentData(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Boolean getPossession() {
        return possession;
    }

    public void setPossession(Boolean possession) {
        this.possession = possession;
    }

    public HomeVisit getHomeVisit() {
        return homeVisit;
    }

    public void setHomeVisit(HomeVisit homeVisit) {
        this.homeVisit = homeVisit;
    }

    public HousingEnvironmentName getHousingEnvironmentName() {
        return housingEnvironmentName;
    }

    public void setHousingEnvironmentName(HousingEnvironmentName housingEnvironmentName) {
        this.housingEnvironmentName = housingEnvironmentName;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HousingEnvironmentData)) {
            return false;
        }
        HousingEnvironmentData other = (HousingEnvironmentData) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.HousingEnvironmentData[ id=" + id + " ]";
    }
    
}
